package com.susong.anqing.forever.main.controller;

import com.susong.anqing.forever.main.service.HumanService;
import com.susong.anqing.forever.model.entity.HumanEntity;
import com.susong.anqing.forever.model.form.HumanForm;
import com.susong.anqing.forever.model.vo.HumanVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author hukai
 * @Package com.susong.anqing.forever.main.controller
 * @date 2024/3/1 16:04
 */
@RestController
@RequestMapping("/human")
public class HumanController {

    @Resource
    private HumanService humanService;

    @PostMapping("/add")
    public int addHuman(@RequestBody @Valid HumanForm form) {
        return humanService.insertOne(form);
    }

    @PostMapping("/alter")
    public HumanEntity alterHuman(@RequestBody @Valid HumanForm form) {
        return humanService.alterHuman(form);
    }

    @PostMapping("/selectOne")
    public HumanVo selectOne(@RequestBody HumanForm form) {
        return humanService.selectOne(form);
    }

}
